<template>
  <div class="invite-bg relative w-full h-screen pt-20 coupon-bg">
    <div class="absolute bottom-4 inset-x-0 px-4">
      <wx-launch class="relative w-full h-16" :path="miniPath">
        <van-button
          block
          type="success"
          size="large"
          class="text-lg"
          :class="isWx ? 'pointer-events-none' : ''"
          @click="$openApp"
        >
          <i class="iconfont icon-wechat mr-1"></i>
          微信用户一键登录</van-button
        >
      </wx-launch>
    </div>
  </div>
</template>

<script>
// import { Toast } from 'vant'
import wxShare from '../plugins/wxShare.js'
import wxLaunch from '../components/wxLaunch.vue'

export default {
  components: { wxLaunch },
  inject: ['isWx'],
  data() {
    return {
      show: false,
      mobile: '',
      qrcode: '',
      uid: '',
      coupon_id: '',
    }
  },
  computed: {
    miniPath() {
      return `/page/give/give?uid=${this.uid}&cid=${this.coupon_id}`
    },
  },
  created() {
    wxShare({
      title: '赠送优惠券',
      imgUrl: '',
      desc: '赠送优惠券',
    })

    // var iurl='https://app.cdgxdb.com/share/h5/Invite.html?userid=270&product=0&tpye=10&sorce=2';
    this.uid = this.$route.query.user_id
    this.coupon_id = this.$route.query.coupon_id
    if (this.uid) {
      this.axios.get(`/users/${this.uid}/baseinfo`).then((res) => {
        if (res.data.status == 1) {
          document.title = res.data.result.nickname + '赠送您优惠券'
        }
      })
    }
  },
  methods: {},
}
</script>

<style>
.coupon-bg {
  background-image: url('../assets/coupon_bg.png');
  background-size: cover;
  background-repeat: no-repeat;
}
</style>
